<template>
  <div class="error-page">
    <el-container>
      <el-main>
        <div class="error-content">
          <div class="error-icon">
            <el-icon size="120" color="#909399">
              <Warning />
            </el-icon>
          </div>

          <h1 class="error-title">404</h1>
          <h2 class="error-subtitle">页面不存在</h2>
          <p class="error-description">抱歉，您访问的页面不存在或已被删除</p>

          <div class="error-actions">
            <el-button type="primary" size="large" @click="goHome"> 返回首页 </el-button>
            <el-button size="large" @click="goBack"> 返回上页 </el-button>
          </div>

          <div class="error-help">
            <p>您可以尝试：</p>
            <ul>
              <li>检查网址是否正确</li>
              <li>返回首页浏览其他内容</li>
              <li>联系客服获取帮助</li>
            </ul>
          </div>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { Warning } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.back()
}
</script>

<style scoped>
.error-page {
  min-height: calc(100vh - 64px);
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-content {
  text-align: center;
  max-width: 600px;
  padding: 40px 20px;
}

.error-icon {
  margin-bottom: 24px;
}

.error-title {
  font-size: 72px;
  font-weight: 700;
  color: #909399;
  margin: 0 0 16px 0;
  line-height: 1;
}

.error-subtitle {
  font-size: 32px;
  font-weight: 600;
  color: #606266;
  margin: 0 0 16px 0;
}

.error-description {
  font-size: 18px;
  color: #909399;
  margin: 0 0 32px 0;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}

.error-help {
  text-align: left;
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.error-help p {
  font-weight: 600;
  color: #606266;
  margin: 0 0 16px 0;
}

.error-help ul {
  margin: 0;
  padding-left: 20px;
  color: #909399;
  line-height: 1.8;
}

.error-help li {
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .error-title {
    font-size: 48px;
  }

  .error-subtitle {
    font-size: 24px;
  }

  .error-actions {
    flex-direction: column;
    align-items: center;
  }

  .error-actions .el-button {
    width: 200px;
  }
}
</style>
